﻿namespace HRM.CORE.Option
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using APP.HELPER;
    using HRM.CORE.CLASS;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Windows.Forms; using Common;
    using Common;

    public class xucContractOption : Common.xucBase
    {
        private CalcEdit calNumberDayWarning;
        private IContainer components = null;
        private GroupBox groupBox1;
        private GroupBox groupBox2;
        private GroupBox groupBox3;
        private LabelControl labelControl1;
        private LabelControl labelControl10;
        private LabelControl labelControl11;
        private LabelControl labelControl12;
        private LabelControl labelControl13;
        private LabelControl labelControl14;
        private LabelControl labelControl2;
        private LabelControl labelControl3;
        private LabelControl labelControl4;
        private LabelControl labelControl5;
        private LabelControl labelControl6;
        private LabelControl labelControl7;
        private LabelControl labelControl8;
        private LabelControl labelControl9;
        private LinkLabel lbFilePath0;
        private LinkLabel lbFilePath1;
        private LinkLabel lbFilePath2;
        private LinkLabel lbFilePath3;
        private ButtonEdit txtFilePath0;
        private ButtonEdit txtFilePath1;
        private ButtonEdit txtFilePath2;
        private ButtonEdit txtFilePath3;
        private TextEdit txtSigner;
        private TextEdit txtSignerNationality;
        private TextEdit txtSignerPosition;

        public xucContractOption()
        {
            this.InitializeComponent();
            this.LoadOption();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(xucContractOption));
            SerializableAppearanceObject appearance = new SerializableAppearanceObject();
            SerializableAppearanceObject obj3 = new SerializableAppearanceObject();
            SerializableAppearanceObject obj4 = new SerializableAppearanceObject();
            SerializableAppearanceObject obj5 = new SerializableAppearanceObject();
            this.txtFilePath0 = new ButtonEdit();
            this.txtFilePath1 = new ButtonEdit();
            this.txtFilePath2 = new ButtonEdit();
            this.txtFilePath3 = new ButtonEdit();
            this.groupBox1 = new GroupBox();
            this.lbFilePath3 = new LinkLabel();
            this.lbFilePath2 = new LinkLabel();
            this.lbFilePath1 = new LinkLabel();
            this.lbFilePath0 = new LinkLabel();
            this.labelControl12 = new LabelControl();
            this.labelControl11 = new LabelControl();
            this.labelControl10 = new LabelControl();
            this.labelControl9 = new LabelControl();
            this.labelControl8 = new LabelControl();
            this.labelControl6 = new LabelControl();
            this.labelControl5 = new LabelControl();
            this.labelControl4 = new LabelControl();
            this.labelControl3 = new LabelControl();
            this.groupBox2 = new GroupBox();
            this.txtSignerNationality = new TextEdit();
            this.labelControl7 = new LabelControl();
            this.labelControl1 = new LabelControl();
            this.labelControl2 = new LabelControl();
            this.txtSignerPosition = new TextEdit();
            this.txtSigner = new TextEdit();
            this.groupBox3 = new GroupBox();
            this.calNumberDayWarning = new CalcEdit();
            this.labelControl14 = new LabelControl();
            this.labelControl13 = new LabelControl();
            this.txtFilePath0.Properties.BeginInit();
            this.txtFilePath1.Properties.BeginInit();
            this.txtFilePath2.Properties.BeginInit();
            this.txtFilePath3.Properties.BeginInit();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.txtSignerNationality.Properties.BeginInit();
            this.txtSignerPosition.Properties.BeginInit();
            this.txtSigner.Properties.BeginInit();
            this.groupBox3.SuspendLayout();
            this.calNumberDayWarning.Properties.BeginInit();
            base.SuspendLayout();
            this.txtFilePath0.Location = new Point(0x98, 0x1b);
            this.txtFilePath0.Name = "txtFilePath0";
            //this.txtFilePath0.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Glyph, "", -1, true, true, false, ImageLocation.MiddleCenter, (Image) manager.GetObject("txtFilePath0.Properties.Buttons"), new KeyShortcut(Keys.None), appearance, "", "Browse", null, true) });
            this.txtFilePath0.Size = new Size(0x134, 0x16);
            this.txtFilePath0.TabIndex = 15;
            this.txtFilePath0.TabStop = false;
            this.txtFilePath0.ButtonClick += new ButtonPressedEventHandler(this.txtFilePath_Properties_ButtonClick);
            this.txtFilePath1.Location = new Point(0x98, 0x4e);
            this.txtFilePath1.Name = "txtFilePath1";
           // this.txtFilePath1.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Glyph, "", -1, true, true, false, ImageLocation.MiddleCenter, (Image) manager.GetObject("txtFilePath1.Properties.Buttons"), new KeyShortcut(Keys.None), obj3, "", "Browse", null, true) });
            this.txtFilePath1.Size = new Size(0x134, 0x16);
            this.txtFilePath1.TabIndex = 0x10;
            this.txtFilePath1.TabStop = false;
            this.txtFilePath1.ButtonClick += new ButtonPressedEventHandler(this.txtFilePath_Properties_ButtonClick);
            this.txtFilePath2.Location = new Point(0x98, 0x81);
            this.txtFilePath2.Name = "txtFilePath2";
            //this.txtFilePath2.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Glyph, "", -1, true, true, false, ImageLocation.MiddleCenter, (Image) manager.GetObject("txtFilePath2.Properties.Buttons"), new KeyShortcut(Keys.None), obj4, "", "Browse", null, true) });
            this.txtFilePath2.Size = new Size(0x134, 0x16);
            this.txtFilePath2.TabIndex = 0x11;
            this.txtFilePath2.TabStop = false;
            this.txtFilePath2.ButtonClick += new ButtonPressedEventHandler(this.txtFilePath_Properties_ButtonClick);
            this.txtFilePath3.Location = new Point(0x98, 0xb6);
            this.txtFilePath3.Name = "txtFilePath3";
            //this.txtFilePath3.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Glyph, "", -1, true, true, false, ImageLocation.MiddleCenter, (Image) manager.GetObject("txtFilePath3.Properties.Buttons"), new KeyShortcut(Keys.None), obj5, "", "Browse", null, true) });
            this.txtFilePath3.Size = new Size(0x134, 0x16);
            this.txtFilePath3.TabIndex = 0x12;
            this.txtFilePath3.TabStop = false;
            this.txtFilePath3.ButtonClick += new ButtonPressedEventHandler(this.txtFilePath_Properties_ButtonClick);
            this.groupBox1.Controls.Add(this.lbFilePath3);
            this.groupBox1.Controls.Add(this.lbFilePath2);
            this.groupBox1.Controls.Add(this.lbFilePath1);
            this.groupBox1.Controls.Add(this.lbFilePath0);
            this.groupBox1.Controls.Add(this.labelControl12);
            this.groupBox1.Controls.Add(this.labelControl11);
            this.groupBox1.Controls.Add(this.labelControl10);
            this.groupBox1.Controls.Add(this.labelControl9);
            this.groupBox1.Controls.Add(this.labelControl8);
            this.groupBox1.Controls.Add(this.labelControl6);
            this.groupBox1.Controls.Add(this.labelControl5);
            this.groupBox1.Controls.Add(this.labelControl4);
            this.groupBox1.Controls.Add(this.labelControl3);
            this.groupBox1.Controls.Add(this.txtFilePath0);
            this.groupBox1.Controls.Add(this.txtFilePath3);
            this.groupBox1.Controls.Add(this.txtFilePath1);
            this.groupBox1.Controls.Add(this.txtFilePath2);
            this.groupBox1.Location = new Point(0x15, 130);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x1dc, 0x125);
            this.groupBox1.TabIndex = 0x13;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Mẫu in hợp đồng lao động";
            this.lbFilePath3.AutoSize = true;
            this.lbFilePath3.LinkColor = Color.DimGray;
            this.lbFilePath3.Location = new Point(0xbd, 0xcf);
            this.lbFilePath3.Name = "lbFilePath3";
            this.lbFilePath3.Size = new Size(0xab, 13);
            this.lbFilePath3.TabIndex = 0x21;
            this.lbFilePath3.TabStop = true;
            this.lbFilePath3.Text = @"..\Report\Hop_Dong_Hoc_Viec.rtf";
            this.lbFilePath3.LinkClicked += new LinkLabelLinkClickedEventHandler(this.lbFilePath3_LinkClicked);
            this.lbFilePath2.AutoSize = true;
            this.lbFilePath2.LinkColor = Color.DimGray;
            this.lbFilePath2.Location = new Point(0xbd, 0x9a);
            this.lbFilePath2.Name = "lbFilePath2";
            this.lbFilePath2.Size = new Size(0xab, 13);
            this.lbFilePath2.TabIndex = 0x21;
            this.lbFilePath2.TabStop = true;
            this.lbFilePath2.Text = @"..\Report\Hop_Dong_Thu_Viec.rtf";
            this.lbFilePath2.LinkClicked += new LinkLabelLinkClickedEventHandler(this.lbFilePath2_LinkClicked);
            this.lbFilePath1.AutoSize = true;
            this.lbFilePath1.LinkColor = Color.DimGray;
            this.lbFilePath1.Location = new Point(0xbd, 0x67);
            this.lbFilePath1.Name = "lbFilePath1";
            this.lbFilePath1.Size = new Size(0x103, 13);
            this.lbFilePath1.TabIndex = 0x21;
            this.lbFilePath1.TabStop = true;
            this.lbFilePath1.Text = @"..\Report\Hop_Dong_Khong_Xac_Dinh_Thoi_Han.rtf";
            this.lbFilePath1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.lbFilePath1_LinkClicked);
            this.lbFilePath0.AutoSize = true;
            this.lbFilePath0.LinkColor = Color.DimGray;
            this.lbFilePath0.Location = new Point(0xbd, 0x34);
            this.lbFilePath0.Name = "lbFilePath0";
            this.lbFilePath0.Size = new Size(0xdf, 13);
            this.lbFilePath0.TabIndex = 0x21;
            this.lbFilePath0.TabStop = true;
            this.lbFilePath0.Text = @"..\Report\Hop_Dong_Xac_Dinh_Thoi_Han.rtf";
            this.lbFilePath0.LinkClicked += new LinkLabelLinkClickedEventHandler(this.lbFilePath0_LinkClicked);
            this.labelControl12.AllowHtmlString = true;
            this.labelControl12.AutoSizeMode = LabelAutoSizeMode.None;
            this.labelControl12.Location = new Point(15, 0xee);
            this.labelControl12.Name = "labelControl12";
            this.labelControl12.Size = new Size(0x1b9, 0x2b);
            this.labelControl12.TabIndex = 0x20;
           // this.labelControl12.Text = manager.GetString("labelControl12.Text");
            this.labelControl11.Appearance.ForeColor = Color.DimGray;
            this.labelControl11.Appearance.Options.UseForeColor = true;
            this.labelControl11.Location = new Point(0x98, 0xcf);
            this.labelControl11.Name = "labelControl11";
            this.labelControl11.Size = new Size(0x26, 13);
            this.labelControl11.TabIndex = 0x1f;
            this.labelControl11.Text = "Mẫu in: ";
            this.labelControl10.Appearance.ForeColor = Color.DimGray;
            this.labelControl10.Appearance.Options.UseForeColor = true;
            this.labelControl10.Location = new Point(0x98, 0x9a);
            this.labelControl10.Name = "labelControl10";
            this.labelControl10.Size = new Size(0x26, 13);
            this.labelControl10.TabIndex = 0x1f;
            this.labelControl10.Text = "Mẫu in: ";
            this.labelControl9.Appearance.ForeColor = Color.DimGray;
            this.labelControl9.Appearance.Options.UseForeColor = true;
            this.labelControl9.Location = new Point(0x98, 0x67);
            this.labelControl9.Name = "labelControl9";
            this.labelControl9.Size = new Size(0x26, 13);
            this.labelControl9.TabIndex = 0x1f;
            this.labelControl9.Text = "Mẫu in: ";
            this.labelControl8.Appearance.ForeColor = Color.DimGray;
            this.labelControl8.Appearance.Options.UseForeColor = true;
            this.labelControl8.Location = new Point(0x98, 0x34);
            this.labelControl8.Name = "labelControl8";
            this.labelControl8.Size = new Size(0x23, 13);
            this.labelControl8.TabIndex = 0x1f;
            this.labelControl8.Text = "Mẫu in:";
            this.labelControl6.Location = new Point(14, 0xbb);
            this.labelControl6.Name = "labelControl6";
            this.labelControl6.Size = new Size(0x58, 13);
            this.labelControl6.TabIndex = 30;
            this.labelControl6.Text = "Hợp đồng học việc";
            this.labelControl5.Location = new Point(14, 0x85);
            this.labelControl5.Name = "labelControl5";
            this.labelControl5.Size = new Size(0x58, 13);
            this.labelControl5.TabIndex = 0x1d;
            this.labelControl5.Text = "Hợp đồng thử việc";
            this.labelControl4.Location = new Point(15, 0x52);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new Size(0x84, 13);
            this.labelControl4.TabIndex = 0x1d;
            this.labelControl4.Text = "HĐ kh\x00f4ng x\x00e1c định thời hạn";
            this.labelControl3.Location = new Point(15, 0x1f);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new Size(100, 13);
            this.labelControl3.TabIndex = 0x1c;
            this.labelControl3.Text = "HĐ x\x00e1c định thời hạn";
            this.groupBox2.Controls.Add(this.txtSignerNationality);
            this.groupBox2.Controls.Add(this.labelControl7);
            this.groupBox2.Controls.Add(this.labelControl1);
            this.groupBox2.Controls.Add(this.labelControl2);
            this.groupBox2.Controls.Add(this.txtSignerPosition);
            this.groupBox2.Controls.Add(this.txtSigner);
            this.groupBox2.Location = new Point(0x15, 0x11);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new Size(0x1dc, 100);
            this.groupBox2.TabIndex = 20;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Người k\x00fd đại diện c\x00f4ng ty";
            this.txtSignerNationality.Location = new Point(0x160, 0x22);
            this.txtSignerNationality.Name = "txtSignerNationality";
            this.txtSignerNationality.Size = new Size(0x6c, 20);
            this.txtSignerNationality.TabIndex = 30;
            this.labelControl7.Location = new Point(0x12f, 0x25);
            this.labelControl7.Name = "labelControl7";
            this.labelControl7.Size = new Size(0x2d, 13);
            this.labelControl7.TabIndex = 0x1d;
            this.labelControl7.Text = "Quốc tịch";
            this.labelControl1.Location = new Point(13, 0x45);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new Size(40, 13);
            this.labelControl1.TabIndex = 0x1c;
            this.labelControl1.Text = "Chức vụ";
            this.labelControl2.Location = new Point(14, 0x24);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new Size(0x20, 13);
            this.labelControl2.TabIndex = 0x1b;
            this.labelControl2.Text = "Họ t\x00ean";
            this.txtSignerPosition.Location = new Point(0x42, 0x43);
            this.txtSignerPosition.Name = "txtSignerPosition";
            this.txtSignerPosition.Size = new Size(0x18a, 20);
            this.txtSignerPosition.TabIndex = 0x1a;
            this.txtSigner.Location = new Point(0x42, 0x22);
            this.txtSigner.Name = "txtSigner";
            this.txtSigner.Size = new Size(0xe0, 20);
            this.txtSigner.TabIndex = 0x19;
            this.groupBox3.Controls.Add(this.calNumberDayWarning);
            this.groupBox3.Controls.Add(this.labelControl14);
            this.groupBox3.Controls.Add(this.labelControl13);
            this.groupBox3.Location = new Point(0x15, 0x1b6);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new Size(0x1dc, 60);
            this.groupBox3.TabIndex = 0x15;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Sắp hết hạn hợp đồng lao động";
            int[] bits = new int[4];
            this.calNumberDayWarning.EditValue = new decimal(bits);
            this.calNumberDayWarning.Location = new Point(0x105, 0x1a);
            this.calNumberDayWarning.Name = "calNumberDayWarning";
            this.calNumberDayWarning.Properties.AllowNullInput = DefaultBoolean.False;
            this.calNumberDayWarning.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.calNumberDayWarning.Properties.Appearance.Options.UseFont = true;
            this.calNumberDayWarning.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.calNumberDayWarning.Properties.Mask.UseMaskAsDisplayFormat = true;
            this.calNumberDayWarning.Size = new Size(0x38, 20);
            this.calNumberDayWarning.TabIndex = 0x24;
            this.labelControl14.AllowHtmlString = true;
            this.labelControl14.Location = new Point(0x143, 0x1d);
            this.labelControl14.Name = "labelControl14";
            this.labelControl14.Size = new Size(0x20, 14);
            this.labelControl14.TabIndex = 0x23;
            this.labelControl14.Text = "(ng\x00e0y)";
            this.labelControl13.AllowHtmlString = true;
            this.labelControl13.Location = new Point(13, 0x1c);
            this.labelControl13.Name = "labelControl13";
            this.labelControl13.Size = new Size(0xf2, 14);
            this.labelControl13.TabIndex = 0x21;
            this.labelControl13.Text = "Thời gian cảnh b\x00e1o sắp hết hạn hợp đồng lao động";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.groupBox3);
            base.Controls.Add(this.groupBox2);
            base.Controls.Add(this.groupBox1);
            base.Name = "xucContractOption";
            base.Padding = new Padding(10);
            base.Size = new Size(0x204, 0x20d);
            this.txtFilePath0.Properties.EndInit();
            this.txtFilePath1.Properties.EndInit();
            this.txtFilePath2.Properties.EndInit();
            this.txtFilePath3.Properties.EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.txtSignerNationality.Properties.EndInit();
            this.txtSignerPosition.Properties.EndInit();
            this.txtSigner.Properties.EndInit();
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.calNumberDayWarning.Properties.EndInit();
            base.ResumeLayout(false);
        }

        private void lbFilePath0_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Process.Start(Application.StartupPath + this.lbFilePath0.Text.Remove(0, 2));
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }

        private void lbFilePath1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Process.Start(Application.StartupPath + this.lbFilePath1.Text.Remove(0, 2));
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }

        private void lbFilePath2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Process.Start(Application.StartupPath + this.lbFilePath2.Text.Remove(0, 2));
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }

        private void lbFilePath3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Process.Start(Application.StartupPath + this.lbFilePath3.Text.Remove(0, 2));
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }

        private void LoadOption()
        {
            clsContractOption option = new clsContractOption();
            this.txtSigner.Text = option.Signer;
            this.txtSignerNationality.Text = option.SignerNationality;
            this.txtSignerPosition.Text = option.SignerPosition;
            this.txtFilePath0.Text = option.FilePath0;
            this.txtFilePath1.Text = option.FilePath1;
            this.txtFilePath2.Text = option.FilePath2;
            this.txtFilePath3.Text = option.FilePath3;
            this.calNumberDayWarning.EditValue = option.NumberDayWarning;
        }

        public void Save()
        {
            clsContractOption.SaveOption(this.txtSigner.Text, this.txtSignerNationality.Text, this.txtSignerPosition.Text, this.txtFilePath0.Text, this.txtFilePath1.Text, this.txtFilePath2.Text, this.txtFilePath3.Text, int.Parse(this.calNumberDayWarning.EditValue.ToString()));
        }

        private void txtFilePath_Properties_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog {
                Filter = "Rich Text File(*.rtf)|*.rtf",
                FilterIndex = 0
            };
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                (sender as ButtonEdit).Text = dialog.FileName;
            }
        }
    }
}

